﻿// 麻省理工学院许可证
//
// 版权所有 (c) 2021-2023 zuohuaijun，大名科技（天津）有限公司  联系电话/微信：18020030720  QQ：515096995
//
// 特此免费授予获得本软件的任何人以处理本软件的权利，但须遵守以下条件：在所有副本或重要部分的软件中必须包括上述版权声明和本许可声明。
//
// 软件按“原样”提供，不提供任何形式的明示或暗示的保证，包括但不限于对适销性、适用性和非侵权的保证。
// 在任何情况下，作者或版权持有人均不对任何索赔、损害或其他责任负责，无论是因合同、侵权或其他方式引起的，与软件或其使用或其他交易有关。

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace Jim.K3Cloud;

public class K3CloudServiceException
{
    /// <summary>类名</summary>
    /// <value>Thnamothclass.</value>
    public string ClassName { get; private set; }

    /// <summary>异常产生的方法</summary>
    /// <value>Thexception method.</value>
    public string ExceptionMethod { get; private set; }

    /// <summary>异常信息，-1为WepApi客户端异常或通讯异常</summary>
    /// <value>Therrocode.</value>
    /// <returns>ThHRESULT otherror.</returns>
    public int ErrorCode { get; set; }

    /// <summary>帮助链接</summary>
    /// <value>Thhelp link.</value>
    /// <returns>ThUniforResourcNam(URN) oUniforResourcLocato(URL).</returns>
    public string HelpLink { get; set; }

    /// <summary>x提示信息</summary>
    /// <value>Thmessage.</value>
    /// <returns>Therromessagthat explains threason fothexception, oan emptstring("").</returns>
    public string Message { get; set; }

    /// <summary>产生异常的对象或应用名</summary>
    /// <value>Thsource.</value>
    /// <returns>Thnamothapplication othobject that causes therror.</returns>
    public string Source { get; set; }

    /// <summary>异常堆栈</summary>
    /// <value>Thstack trace.</value>
    /// <returns>A string that describes thimmediatframes othcall stack.</returns>
    /// <PermissionSet>
    ///   <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" PathDiscovery="*AllFiles*" />
    /// </PermissionSet>
    public string StackTrace { get; set; }

    /// <summary>数据</summary>
    /// <value>Thdata.</value>
    /// <returns>An object that implements th<secref="T:System.Collections.IDictionary" /> interface and contains a collection ouser-defined key/valupairs. Thdefault is an emptcollection.</returns>
    public IDictionary Data { get; set; }

    /// <summary>异常是否处理，如果不希望异常再次抛出，需要在处理程序中将该值设置为True</summary>
    /// <value><c>true</c> ihandled; otherwise, <c>false</c>.</value>
    public bool Handled { get; set; }

    /// <summary>服务端执行时内部异常</summary>
    /// <value>Thinneex wrapper.</value>
    public K3CloudExceptionWrapper InnerExWrapper { get; set; }

}


/// <summary>服务端异常信息封装</summary>
public class K3CloudExceptionWrapper
{

    /// <summary>数据</summary>
    public IDictionary Data { get; private set; }

    /// <summary>帮助链接</summary>
    public string HelpLink { get; set; }

    /// <summary>消息</summary>
    public string Message { get; set; }

    /// <summary>产生异常的对象或应用名称</summary>
    public string Source { get; set; }

    /// <summary>异常堆栈</summary>
    public string StackTrace { get; set; }

    /// <summary>抛出异常的方法</summary>
    public string TargetSite { get; set; }

    /// <summary>异常类型</summary>
    public string ExceptionType { get; set; }

    public K3CloudExceptionWrapper InnerException { get; set; }
}